package com.ruoyi.celoan.service.impl;

import com.alibaba.fastjson2.JSONObject;
import com.ruoyi.celoan.dto.EnterpriseInfoQueryDto;
import com.ruoyi.celoan.dto.EnterpriseInfoQueryModel;
import com.ruoyi.celoan.entity.DalianDataReportKeyEntity;
import com.ruoyi.celoan.entity.ExTradeEffectEnterprisesDetailSqsEntity;
import com.ruoyi.celoan.handanUtils.HanDanHttpSelectUtils;
import com.ruoyi.celoan.handanUtils.HanDanHttpUtils;
import com.ruoyi.celoan.handanUtils.response.CountryPlatformResponse;
import com.ruoyi.celoan.service.ExTradeEffectSelectService;
import com.ruoyi.celoan.service.IEcDalianDataReportKeyService;
import com.ruoyi.common.core.domain.AjaxResult;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class ExTradeEffectSelectServiceImpl
        implements ExTradeEffectSelectService {
    private static final Logger log = LoggerFactory.getLogger(ExTradeEffectSelectServiceImpl.class);
    @Autowired
    private IEcDalianDataReportKeyService keyService;
    private static String appKey = "CCB004";

    public String getToken() {
        EnterpriseInfoQueryDto queryDto = new EnterpriseInfoQueryDto();
        log.info("加载调用客户端配置");
        DalianDataReportKeyEntity entity = this.keyService.selectEntity(appKey);
        String token = HanDanHttpUtils.getToken();
        return token;
    }

    public AjaxResult querySelectTjxx(EnterpriseInfoQueryModel model) {
        log.info("市场主体登记信息查询接口查询");
        CountryPlatformResponse tjxx = HanDanHttpSelectUtils.businessInfoQuery(JSONObject.toJSONString(model), getToken());
        if (tjxx.isApiStatus()) {
            return AjaxResult.success(tjxx.getData());
        }
        log.info("市场主体登记信息查询接口完成" + JSONObject.toJSONString(tjxx));
        return AjaxResult.error();
    }

    public AjaxResult querySelectXzxk(EnterpriseInfoQueryModel model) {
        log.info("行政许可信息查询接口");
        CountryPlatformResponse xzxk = HanDanHttpSelectUtils.administrativeLicensing(JSONObject.toJSONString(model), getToken());
        if (xzxk.isApiStatus()) {
            return AjaxResult.success(xzxk.getData());
        }
        log.info("执行行政许可信息查询接口完成" + JSONObject.toJSONString(xzxk));
        return AjaxResult.error();
    }

    public AjaxResult querySelectXzcf(EnterpriseInfoQueryModel model) {
        log.info("行政处罚信息查询接口");
        CountryPlatformResponse xzcf = HanDanHttpSelectUtils.administrativeSanction(JSONObject.toJSONString(model), getToken());
        if (xzcf.isApiStatus()) {
            return AjaxResult.success(xzcf.getData());
        }
        log.info("执行行政处罚信息查询接口完成" + JSONObject.toJSONString(xzcf));
        return AjaxResult.error();
    }

    public AjaxResult querySelectAjnsr(EnterpriseInfoQueryModel model) {
        log.info("A级纳税人查询接口");
        CountryPlatformResponse ajnsr = HanDanHttpSelectUtils.classATaxpayer(JSONObject.toJSONString(model), getToken());
        if (ajnsr.isApiStatus()) {
            return AjaxResult.success(ajnsr.getData());
        }
        log.info("A级纳税人查询接口查询完成" + JSONObject.toJSONString(ajnsr));
        return AjaxResult.error();
    }

    public AjaxResult querySelectNshy(EnterpriseInfoQueryModel model) {
        log.info("企业是否纳税非正常户核验接口");
        CountryPlatformResponse nshy = HanDanHttpSelectUtils.abnormalTaxpayer(JSONObject.toJSONString(model), getToken());
        if (nshy.isApiStatus()) {
            return AjaxResult.success(nshy.getData());
        }
        log.info("企业是否纳税非正常户核验接口查询完成" + JSONObject.toJSONString(nshy));
        return AjaxResult.error();
    }

    public AjaxResult querySelectAshy(EnterpriseInfoQueryModel model) {
        log.info("企业是否欠税核验接口");
        CountryPlatformResponse qshy = HanDanHttpSelectUtils.gwyTaxArrears(JSONObject.toJSONString(model), getToken());
        if (qshy.isApiStatus()) {
            return AjaxResult.success(qshy.getData());
        }
        log.info("企业是否欠税核验接口完成" + JSONObject.toJSONString(qshy));
        return AjaxResult.error();
    }

    public AjaxResult querySelectFypjs(EnterpriseInfoQueryModel model) {
        log.info("法院判决信息接口");
        CountryPlatformResponse fypjs = HanDanHttpSelectUtils.judgementDocuments(JSONObject.toJSONString(model), getToken());
        if (fypjs.isApiStatus()) {
            return AjaxResult.success(fypjs.getData());
        }
        log.info("法院判决信息接口完成" + JSONObject.toJSONString(fypjs));
        return AjaxResult.error();
    }

    public AjaxResult querySelectPcaj(EnterpriseInfoQueryModel model) {
        log.info("破产案件信息查询接口");
        CountryPlatformResponse pcaj = HanDanHttpSelectUtils.bankruptcyCase(JSONObject.toJSONString(model), getToken());
        if (pcaj.isApiStatus()) {
            return AjaxResult.success(pcaj.getData());
        }
        log.info("破产案件信息查询接口完成" + JSONObject.toJSONString(pcaj));
        return AjaxResult.error();
    }

    public AjaxResult querySelectZjbcaj(EnterpriseInfoQueryModel model) {
        log.info("终结本次执行案件信息查询接口");
        CountryPlatformResponse zjbcaj = HanDanHttpSelectUtils.endCaseExecution(JSONObject.toJSONString(model), getToken());
        if (zjbcaj.isApiStatus()) {
            return AjaxResult.success(zjbcaj.getData());
        }
        log.info("终结本次执行案件信息查询接口完成" + JSONObject.toJSONString(zjbcaj));
        return AjaxResult.error();
    }

    public AjaxResult querySelectHgzc(EnterpriseInfoQueryModel model) {
        log.info("海关注册信息查询接口");
        CountryPlatformResponse hgzc = HanDanHttpSelectUtils.customsRegistrationInformation(JSONObject.toJSONString(model), getToken());
        if (hgzc.isApiStatus()) {
            return AjaxResult.success(hgzc.getData());
        }
        log.info("海关注册信息查询接口完成" + JSONObject.toJSONString(hgzc));
        return AjaxResult.error();
    }

    public AjaxResult querySelectHgxydj(EnterpriseInfoQueryModel model) {
        log.info("海关信用等级信息查询接口");
        CountryPlatformResponse hgxydj = HanDanHttpSelectUtils.customsCreditRating(JSONObject.toJSONString(model), getToken());
        if (hgxydj.isApiStatus()) {
            return AjaxResult.success(hgxydj.getData());
        }
        log.info("海关信用等级信息查询接口完成" + JSONObject.toJSONString(hgxydj));
        return AjaxResult.error();
    }

    public AjaxResult querySelectQysb(EnterpriseInfoQueryModel model) {
        log.info("企业商标信息查询接口");
        CountryPlatformResponse qysb = HanDanHttpSelectUtils.trademark(JSONObject.toJSONString(model), getToken());
        if (qysb.isApiStatus()) {
            return AjaxResult.success(qysb.getData());
        }
        log.info("企业商标信息查询接口完成" + JSONObject.toJSONString(qysb));
        return AjaxResult.error();
    }

    public AjaxResult querySelectHmd(EnterpriseInfoQueryModel model) {
        log.info("黑名单信息查询接口");
        CountryPlatformResponse hmd = HanDanHttpSelectUtils.blackList(JSONObject.toJSONString(model), getToken());
        if (hmd.isApiStatus()) {
            return AjaxResult.success(hmd.getData());
        }
        log.info("黑名单信息查询接口完成" + JSONObject.toJSONString(hmd));
        return AjaxResult.error();
    }

    public AjaxResult querySelectZlxx(EnterpriseInfoQueryModel model) {
        log.info("专利信息查询接口");
        CountryPlatformResponse zjxx = HanDanHttpSelectUtils.patent(JSONObject.toJSONString(model), getToken());
        if (zjxx.isApiStatus()) {
            return AjaxResult.success(zjxx.getData());
        }
        log.info("专利信息查询接口完成" + JSONObject.toJSONString(zjxx));
        return AjaxResult.error();
    }

    public AjaxResult querySelectJckzlxx(EnterpriseInfoQueryModel model) {
        log.info("基础库专利信息查询接口");
        CountryPlatformResponse jckzlxx = HanDanHttpSelectUtils.localPatent(JSONObject.toJSONString(model), getToken());
        if (jckzlxx.isApiStatus()) {
            return AjaxResult.success(jckzlxx.getData());
        }
        log.info("基础库专利信息查询接口完成" + JSONObject.toJSONString(jckzlxx));
        return AjaxResult.error();
    }

    public AjaxResult querySelectXzqz(EnterpriseInfoQueryModel model) {
        log.info("行政强制信息查询接口");
        CountryPlatformResponse xzqz = HanDanHttpSelectUtils.administrativeForce(JSONObject.toJSONString(model), getToken());
        if (xzqz.isApiStatus()) {
            return AjaxResult.success(xzqz.getData());
        }
        log.info("行政强制信息查询接口完成" + JSONObject.toJSONString(xzqz));
        return AjaxResult.error();
    }

    public AjaxResult querySelectRjzzq(EnterpriseInfoQueryModel model) {
        log.info("软件著作权信息查询接口");
        CountryPlatformResponse rjzzq = HanDanHttpSelectUtils.softwareCopyright(JSONObject.toJSONString(model), getToken());
        if (rjzzq.isApiStatus()) {
            return AjaxResult.success(rjzzq.getData());
        }
        log.info("软件著作权信息查询接口完成" + JSONObject.toJSONString(rjzzq));
        return AjaxResult.error();
    }

    public AjaxResult shouQuan(ExTradeEffectEnterprisesDetailSqsEntity model) {
        log.info("上传企业授权接口");
        CountryPlatformResponse platformResponse = HanDanHttpSelectUtils.sendUploadLicense(HanDanHttpUtils.apiUrl + "/api/creditInquiry/uploadLegalPersonLicense", model, getToken());
        if (platformResponse.isApiStatus()) {
            return AjaxResult.success(platformResponse.getData());
        }
        log.info("上传企业授权接口完成" + JSONObject.toJSONString(platformResponse));
        return AjaxResult.error();
    }

    public AjaxResult cancelLicense(EnterpriseInfoQueryModel model) {
        log.info("取消授权协议");
        CountryPlatformResponse response = HanDanHttpSelectUtils.cancelLicense(JSONObject.toJSONString(model), getToken());
        if (response.isApiStatus()) {
            return AjaxResult.success(response.getData());
        }
        log.info("取消授权协议完成" + JSONObject.toJSONString(response));
        return AjaxResult.error();
    }

    public AjaxResult querySelectGgzyjy(EnterpriseInfoQueryModel model) {
        log.info("公共资源交易记录查询接口");
        CountryPlatformResponse ggzyjy = HanDanHttpSelectUtils.simplePublicResourcesTrading(JSONObject.toJSONString(model), getToken());
        if (ggzyjy.isApiStatus()) {
            return AjaxResult.success(ggzyjy.getData());
        }
        log.info("公共资源交易记录查询接口完成" + JSONObject.toJSONString(ggzyjy));
        return AjaxResult.error();
    }

    public AjaxResult accumulationFund(EnterpriseInfoQueryModel model) {
        log.info("住房公积金缴纳情况查询接口");
        CountryPlatformResponse fypjs = HanDanHttpSelectUtils.judgementDocuments(JSONObject.toJSONString(model), getToken());
        if (fypjs.isApiStatus()) {
            return AjaxResult.success(fypjs.getData());
        }
        log.info("住房公积金缴纳情况查询结果" + JSONObject.toJSONString(fypjs));
        return AjaxResult.error();
    }

    public AjaxResult socialInsurance(EnterpriseInfoQueryModel model) {
        log.info("社保保险费缴纳情况查询接口");
        CountryPlatformResponse fypjs = HanDanHttpSelectUtils.socialInsurance(JSONObject.toJSONString(model), getToken());
        if (fypjs.isApiStatus()) {
            return AjaxResult.success(fypjs.getData());
        }
        log.info("社保保险费缴纳情况查询结果" + JSONObject.toJSONString(fypjs));
        return AjaxResult.error();
    }

    public AjaxResult socialInsuranceArrears(EnterpriseInfoQueryModel model) {
        log.info("社保欠缴信息查询接口");
        CountryPlatformResponse fypjs = HanDanHttpSelectUtils.socialInsuranceArrears(JSONObject.toJSONString(model), getToken());
        if (fypjs.isApiStatus()) {
            return AjaxResult.success(fypjs.getData());
        }
        log.info("社保欠缴信息查询结果" + JSONObject.toJSONString(fypjs));
        return AjaxResult.error();
    }
}


/* Location:              D:\tuodayun\workspace\work\celoan-third-data-report-service-2.0.0-SNAPSHOT.jar!\BOOT-INF\classes\com\celoan\service\impl\ExTradeEffectSelectServiceImpl.class
 * Java compiler version: 8 (52.0)
 * JD-Core Version:       1.1.3
 */
